<?php


use Phinx\Seed\AbstractSeed;

class Role extends AbstractSeed
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * https://book.cakephp.org/phinx/0/en/seeding.html
     */
    public function run(): void
    {
        $role = [
            ['name'=>'超级管理员','status'=>1,'create_time'=>date('Y-m-d H:i:s'),'update_time'=>date('Y-m-d H:i:s')]
        ];
        $posts = $this->table('role');
        $posts->insert($role)
          ->saveData();

        $relation = [
            ['user_id'=>1, 'role_id'=>1, 'create_time'=>date('Y-m-d H:i:s'),'update_time'=>date('Y-m-d H:i:s'),'status'=>1]
        ];
        $posts = $this->table('user_role_relation');
        $posts->insert($relation)
          ->saveData();
    }
}
